<template>
	<gui-page ref="guiPage" :customHeader="true">
		<template v-slot:gHeader>
			<nav-bar-custom left-icon="left" :title="$t('distributedEnter.scanRecord')"></nav-bar-custom>
		</template>
		<template v-slot:gBody>
			<view v-if="data.returnSpScanList.length==0" class="noticeHooks">
					    {{data.returnSpScanList.length == 0 ? $t('stockManage.notAvailable') : $t('stockManage.without')}}
			</view>
			<view class="record-card" v-for="(item,index) in data.returnSpScanList" :key="`${item.barcode}` + `${index}`" v-else>
				<uni-icons class="close-icons" type="closeempty" color="#9C9C9C" size="30" @click="handelClosePopup(index,item)"></uni-icons>
				<view class="card-mini-head">
					<view class="title-line"></view>
					<text>{{$t('translationImage.serialNumber')}}：{{data.returnSpScanList.length-index}}</text>
				</view>
				<!-- <view class="custom-card-itemOne">
					<text class="item-info-title">{{$t('hardwareOut.materialsName')}}：</text>{{ item.picker }}
				</view> -->
				
				<view class="custom-card-itemOne">
					<text class="item-info-title">{{$t('hardwareOut.materialCard')}}：</text>{{ item.barcode }}
				</view>
				<view class="custom-card-itemOne">
					<text class="item-info-title">{{$t('distributedEnter.materialCode')}}：</text> {{ item.materialCode }}
				</view>
				<view class="custom-card-itemOne">
					<text class="item-info-title">{{$t('distributedEnter.materialName')}}：</text>{{ item.materialName }}
				</view>
				<view class="custom-card-itemOne">
					<text class="item-info-title">{{$t('distributedEnter.materialSpec')}}：</text>{{ item.materialSpec || '' }}
				</view>
				<view class="custom-card-itemOne">
					<text class="item-info-title">{{$t('distributedEnter.uom')}}：</text>{{ item.unit }}
				</view> 
				<view class="custom-card-itemOne">
					<text class="item-info-title">{{$t('hardwareOut.rejectedMaterialQty')}}：</text>{{ item.inputNum }}
				</view>
				<view class="custom-card-itemOne">
					<text class="item-info-title">{{$t('materials.expenseItem')}}：</text>{{ item.costItem }}
				</view>
				<view class="custom-card-itemOne">
					<text class="item-info-title">{{$t('materials.remark')}}：</text>{{ item.remark }}
				</view>
			</view>
		</template>
	</gui-page>
</template>

<script setup>
	import { navigate } from '@/utils/routerSkip.js';
	import { useStore } from "vuex";
	import { basPdaOperationLogFn } from '@/utils/index.js';
	import { OPERATION_DEL, OPERATION_LOOK } from '@/constant/index.js'
	import {
		computed,
		reactive,
		onMounted
	} from 'vue';
	onMounted(()=>{
		try {
			let inputParameter = '无'
			let returnParameter = JSON.stringify(data.returnSpScanList)
			let operationPicture = '返还五金仓'
			let callInterface = '无'
			let opertionParmes = {
				inputParameter,
				returnParameter,
				operationPicture,
				callInterface,
				responseCode:'无',//返回状态
				errorMessage:'无',//错误信息
				isPass:'Y',//是否成功 Y N
				operationType:OPERATION_LOOK,
				module:'WMS',
				source: "PDA",
			}
			basPdaOperationLogFn(opertionParmes)
		} catch (error) {
		}
	})
	let data = reactive({
		returnSpScanList:[],
	})
	let store = useStore();
	// fqc扫描条码
	data.returnSpScanList = computed(() => {
		return store.state.hardWare.returnSpScanList
	})
	const handelClosePopup = (index,item) => {
		try {
			let inputParameter = '无'
			let returnParameter = JSON.stringify(item)
			let operationPicture = '返还五金仓'
			let callInterface = '无'
			let opertionParmes = {
				inputParameter,
				returnParameter,
				operationPicture,
				callInterface,
				responseCode:'无',//返回状态
				errorMessage:'无',//错误信息
				isPass:'Y',//是否成功 Y N
				operationType:OPERATION_DEL
			}
			basPdaOperationLogFn(opertionParmes)
		} catch (error) {
		}
		store.dispatch('hardWare/delReturnSpScanListItem', index)
	}
</script>

<style>

</style>
